#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <stdio.h>
#include <stack>
#include <string>
using namespace std;

bool chkParenthesis(string A, int n) {
    if (A.size() == 0)
        return true;
    int i = 0;
    stack<char> st;
    for (i = 0; i < n; i++)
    {

        if (A[i] != '(' && A[i] != ')')
            return false;

        if (A[i] == '(')
            st.push(A[i]);

        else if (A[i] == ')' && st.top() == '(')
            st.pop();

    }
    return st.empty();
}


int main()
{
    while (1)
    {
        string A;
        getline(cin, A);
        cout << chkParenthesis(A, A.size());
    }
    return 0;
}
